<%@page contentType="text/html; charset=UTF-8"%>
<%@ include file="common.jsp" %>

<html>
	<head>
	<title>用户注册</title>
	</head>
	<body>
<%@ include file="include.jsp" %>
		<center>
		<h3>请输入用户信息</h3><br/>
		
		<s:fielderror />
		<s:actionerror />
		<span id="tip" style="color:red;font-weight:bold"></span>
		<% 
			if(request.getAttribute("user") != null) {
		%>
		<s:form action="user-edit.action" method="post" validate="true">
			<s:hidden name="user.id" value="%{user.id}"></s:hidden>
			<s:textfield name="user.username" value="%{user.username}" label="用户名"/><br />
			<s:textfield name="user.password" value="%{user.password}" label="密码"/><br />
			<s:textfield name="user.realname" value="%{user.realname}" label="真实姓名"/><br />
			<s:submit value="提交"/>
		</s:form>
		<% 
			}else {
		%>
		<s:form action="user-regist.action" method="post" validate="true">
			<s:hidden name="user.id" value="%{user.id}"></s:hidden>
			<s:textfield name="user.username" value="%{user.username}" label="用户名"/><br />
			<s:textfield name="user.password" value="%{user.password}" label="密码"/><br />
			<s:textfield name="user.realname" value="%{user.realname}" label="真实姓名"/><br />
			<s:submit value="注册"/>
		</s:form>
		<% 
			}
		%>
		</center>
	</body>
</html>